<!--<!DOCTYPE html>-->
<html>
	<head>
		<meta charset="UTF-8">
		<title>京东数据</title>
	</head>
	<body>
		<input id="kw" placeholder="搜索词" />
		<input type="button"  value="搜索" onclick="search()"/>
		<div id="jddata"></div>
	</body>
	<script>
		function search(){
			var jdscripts=document.getElementsByClassName("jdscript");
			for(var i=0;i<jdscript.length;i++){
				jdscripts[i].parentNode.removeChild(jdscripts[i]);
			}
			jddata.innerHTML="";
			var jdjs=document.createElement("script");
			jdjs.className="jdscript";
			jdjs.src="https://x.jd.com/Search?callback=getjddata&area=1&enc=utf-8&keyword="+kw.value+"&adType=7&page=2&ad_ids=291%3A33&xtest=new_search&_=1516094140760";
			document.body.appendChild(jdjs)
		}
		function getjddata(data){
			var datas;
			for(var d in data){
				datas=data[d]
			}
			for(var i=0;i<datas.length;i++){
				var d=datas[i];
				var newp=document.createElement("p");
				newp.innerHTML=d.ad_title;
				jddata.appendChild(newp);
			}
		}
	</script>
	<script class="jdscript" src="https://x.jd.com/Search?callback=getjddata&area=1&enc=utf-8&keyword=iphone&adType=7&page=2&ad_ids=291%3A33&xtest=new_search&_=1516094140760"></script>
</html>
